﻿<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'grade-form1',
	// Please note: When you enable ajax validation, make sure the corresponding
	// controller action is handling ajax validation correctly.
	// There is a call to performAjaxValidation() commented in generated controller code.
	// See class documentation of CActiveForm for details on this.
	'enableAjaxValidation'=>false,
)); ?>

<?php foreach($students as $st): ?>
		<tr>
		<?php foreach(Grade::model()->findAllByAttributes(array('userid'=>$st->users_id)) as $g0): ?>
        	<td>
            <?php $_id = $g0->id; ?>
            <?php echo $g0->id . ""; ?>
            <?php //echo CHtml::textField('txtFieldName', Grade::model()->FindByPk($g0->id)->grade); ?>
            <?php echo $form->textField($model2, "[$_id]grade", array('value'=>Grade::model()->findByPk($g0->id)->grade, 'size'=>2)); ?>
            </td>
        <?php endforeach; ?>
        </tr>
<?php endforeach; ?>

<div class="row buttons">
		<?php echo CHtml::submitButton($model2->isNewRecord ? 'Save' : 'Save'); ?>
</div>			

<?php $this->endWidget(); ?>
</div><!-- form -->